/*
 * @Description: Description
 * @Author: Kerwin
 * @Date: 2025-05-16 18:10:26
 * @LastEditTime: 2025-05-16 18:10:30
 * @LastEditors:  Please set LastEditors
 */


//年月日时分秒
export function formatDateTime(time) {
	let d = new Date()
	d.setTime(time)
	let year = d.getFullYear()
	let month = d.getMonth() + 1
	let days = d.getDate()
	let hours = d.getHours()
	let minutes = d.getMinutes();
	let seconds = d.getSeconds();
	// 格式 0000-00-00 00:00
	if (days < 10) {
		days = '0' + days
	}
	if (hours < 10) {
		hours = '0' + hours
	}
	if (month < 10) {
		month = '0' + month
	}
	if (minutes < 10) {
		minutes = '0' + minutes
	}
	if (seconds < 10) {
		seconds = '0' + seconds
	}
	return `${year}-${month}-${days} ${hours}:${minutes}`;
}
// 仅返回年月日 格式：YYYY-MM-DD
export function formatDate(time) {
	let d = new Date();
	d.setTime(time);
	let year = d.getFullYear();
	let month = d.getMonth() + 1;
	let days = d.getDate();

	// 补零操作
	if (month < 10) {
		month = '0' + month;
	}
	if (days < 10) {
		days = '0' + days;
	}

	return `${year}-${month}-${days}`;
}